package kr.momo
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import kr.momo.itembox.ItemBox;
	import kr.momo.tmaker.TMakerView;
	
	/**
	 * ...
	 * @author momo
	 */
	public class Main extends Sprite 
	{
		private var itemBox:ItemBox;
		private var maker:TMakerView;
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			maker = new TMakerView();
			addChild( maker );
			
			itemBox = new ItemBox();
			addChild( itemBox );
			
			stage.addEventListener( Event.RESIZE, resizeHandler );
			resizeHandler();
			
			// TODO: 디자인 오브젝트를 선택하면 바로 더미객체가 생성되게 한다.
		}
		
		private function resizeHandler(e:Event = null):void 
		{
			itemBox.x = stage.stageWidth * 0.5 - itemBox.itemBoxWidth * 0.5;
			itemBox.y = stage.stageHeight - itemBox.height;
		}
		
	}
	
}